<?php
class testmdl{
    var $main_func = 'autoload';

    function testmdl($args){
        if(!isset($args['func']) || $args['func'] == '') $args['func'] = $this->main_func;
        $this->$args['func']($args);
    }
  	
    private function autoload($args){
    	global $security;
		if($security->user()) var_dump($security->user);
    }
	
	private function logout () {
		header('WWW-Authenticate: Basic realm="My Realm"');
		header('HTTP/1.0 401 Unauthorized'); 
	}
	
	private function login () {
		global $security;
		if($security->user()) echo '{ "login": "pass",
		  		"result": "'.$security->user['firstname'].'"
		  		}';
	}
}
?>
